"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, io } = app;
  router.get("/", controller.home.index);
  router.get("/d", controller.home.download);
  router.get("/detail", controller.home.detail);
  router.get("/admin", controller.admin.index);
  router.get("/admin/tv/add", controller.admin.tvAdd);
  router.get("/admin/tv/list", controller.admin.tvList);
  router.get("/admin/tv/classify", controller.admin.tvClassify);
  router.get("/admin/movie/add", controller.admin.movieAdd);
  router.get("/admin/movie/list", controller.admin.movieList);
  router.get("/admin/movie/classify", controller.admin.movieClassify);
  router.get("/admin/app/setting", controller.admin.appSetting);

  router.get("/test", controller.home.test);

  router.post("/v1/upload/pic", controller.file.uploadPic);
  router.post("/v1/config/space", controller.home.getConfigSpace);
  /**web manage */

  router.get("/v1/web/sse", controller.home.sse); /**sse */
  router.post("/v1/web/notifi/count", controller.notifi.getCount);
  router.post("/v1/web/notifi/list", controller.notifi.getList);
  router.post("/v1/web/notifi/read", controller.notifi.readNotifi);
  router.post("/v1/web/douban/search", controller.film.doubanSearch);
  router.post("/v1/web/douban/item", controller.film.getDoubanItem);
  router.post("/v1/web/index/data", controller.home.getIndexData);
  router.post("/v1/web/tv/search/preset", controller.tv.searchByPreset);
  router.post("/v1/web/tv/add", controller.tv.addTeleplay);
  router.post("/v1/web/tv/info", controller.tv.getTeleplayInfo);
  router.post("/v1/web/tv/list", controller.tv.getTeleplayList);

  router.post("/v1/web/tv/update", controller.tv.updateTeleplayInfo);
  router.post("/v1/web/tv/delete", controller.tv.deleteTeleplay);
  router.post("/v1/web/tv/classify", controller.tv.getClassify);
  router.post("/v1/web/tv/classify/add", controller.tv.addClassify);
  router.post("/v1/web/tv/classify/delete", controller.tv.deleteClassify);
  router.post("/v1/web/tv/classify/update", controller.tv.updateClassify);
  router.post("/v1/web/movie/search/preset", controller.movie.searchByPreset);
  router.post("/v1/web/movie/list", controller.movie.getMovieList);
  router.post("/v1/web/movie/info", controller.movie.getMovieDetail);
  router.post("/v1/web/movie/delete", controller.movie.deleteMovie);
  router.post("/v1/web/movie/update", controller.movie.updateInfo);
  router.post("/v1/web/movie/classify", controller.movie.getClassify);
  router.post("/v1/web/movie/classify/add", controller.movie.addClassify);
  router.post("/v1/web/movie/classify/delete", controller.movie.deleteClassify);
  router.post("/v1/web/movie/classify/update", controller.movie.updateClassify);
  /**web app */
  router.post("/v1/web/movie/add", controller.movie.addMovie);
  /**tv app */
  router.post("/v1/app/tv/classify", controller.tv.getClassify);
  router.post("/v1/app/tv/info", controller.tv.getTeleplayInfo);
  router.post("/v1/app/tv/play", controller.tv.getTeleplayPlay);
  router.post("/v1/app/tv/list", controller.tv.getTeleplayList);
  router.post("/v1/app/movie/classify", controller.movie.getClassify);
  router.post("/v1/app/movie/list", controller.movie.getMovieList);
  router.post("/v1/app/movie/info", controller.movie.getMovieDetail);
  router.post("/v1/app/film/last/add", controller.film.lastAdd); //最新添加
  router.post("/v1/app/film/recommend/random", controller.film.recommendRandom); //随机推荐
  router.get("/v1/app/iptv", controller.iptv.index);

  /* socket io*/
  io.route("file", io.controller.file.file_select);
};
